#ifndef __IMA_ACTIVE_USERS_H__
#define __IMA_ACTIVE_USERS_H__

#include <string>
#include <map>

class ImaActiveUsers {
	private:
		static ImaActiveUsers* mpInstance;
		ImaActiveUsers();
		//bool removeUser(const unsigned long& userId);
		bool removeUser(const std::string& strEmailId);

	private:
		typedef struct user_session_info{
			std::string tokenId;
			time_t lastAccessTime;
		} USER_SESSION_INFO;

		typedef std::map<std::string, USER_SESSION_INFO*> SessionMap;
		SessionMap mSessionMap;

	public:
		~ImaActiveUsers();
		static ImaActiveUsers* getInstance();
		bool isUserActive(const std::string& emailId, const std::string& strTokenId);
		bool removeUser(const std::string& emailId, const std::string& strTokenId);
		int removeTimedoutUSers();	//TODO: This would be invoked via a separate thread	
		int insertUser(const std::string& emailId, const std::string& tokenId);
};


#endif//__IMA_ACTIVE_USERS_H__
